<template>
  <div class="index">
    <el-container>
      <el-main>
        <el-header>
          <div class="book-title">管理员 (Mi) </div>
          <div><el-button type="danger" class="book-add" @click="loginOut">退出登录</el-button></div>
        </el-header>

        <div class="admin-logo">
          <el-image src="//cdn.staticaly.com/gh/codeslive/images-pages@main/2023/202305212341336.webp" lazy
            @click="wangwang()"></el-image>
        </div>

      </el-main>
    </el-container>
  </div>
</template>

<script>
import { mapState, mapMutations } from "vuex";
export default {
  name: '',
  data () {
    return {

    }
  },
  methods: {
    ...mapMutations("user", [
      "getCirecleImg",
      "getName",
      "getShow",
      "openLogin",
    ]),
    loginOut () {
      // 清除token
      this.getName('请登录');
      this.getCirecleImg('');
      localStorage.removeItem("nickname");
      localStorage.removeItem("account");
      localStorage.removeItem("role");
      localStorage.removeItem("token");
      localStorage.removeItem("img");
      // 跳转到登录页面
      this.$router.push('/home')
    },

    wangwang () {
      this.$message({
        duration: 1500,
        message: '欢迎来到管理员页面, 汪汪汪~',
        type: 'success'
      });
    },
  },
  created () {
    // this.showTip();
  }
}
</script>

<style scoped>
/* 全局样式 */



.el-header {
  border: 1px solid gainsboro;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 3px;
}

.el-header .book-title {
  font-size: 20px;
  margin-left: 20px;
  font-weight: bold;
}

.el-header .book-add {
  margin-right: 20px;
}

.el-button--danger {
  margin: 0 10px;
  padding: 0 5px;
}

.admin-logo {
  max-height: 300px;
  display: flex;
  justify-content: center;
  margin-top: 50px;
  border: 1px solid gainsboro;
  border-radius: 3px;
}


.admin-logo .el-image {
  width: 150px;
  height: 150px;
  margin: 20px 0;
  border-radius: 5px;
}


.admin-logo .el-image:hover {
  /* //添加提示 */
  cursor: pointer;
  transition: all 2s;
  transform: scale(1.2);
}
</style>
